package com.empire.framework.common.enums;

import cn.hutool.core.util.ArrayUtil;
import com.empire.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 全局用户类型枚举
 */
@AllArgsConstructor
@Getter
public enum WarnTypeEnum implements IntArrayValuable {

    FENCE(1, "围栏预警"),
    GATHER(2, "聚集预警"),
    IN_OR_OUT_HZ(3, "出入杭预警"),
    THIRD(4, "接入预警"),
    LOSE_TRACE(5, "失轨预警"),
    BUY(6, "购物预警"),
    SPEECH(7, "言论预警"),
    ;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(WarnTypeEnum::getValue).toArray();

    /**
     * 类型
     */
    private final Integer value;
    /**
     * 类型名
     */
    private final String name;

    public static WarnTypeEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(userType -> userType.getValue().equals(value), WarnTypeEnum.values());
    }

    @Override
    public int[] array() {
        return ARRAYS;
    }
}
